const shortcut = {
    template: "\
    <div class='py-container'> \
        <div class='shortcut'> \
            <ul class='fl'> \
               <li class='f-item' v-if='user && user.username'>\
               <span>乐优欢迎您！</span>\
               尊敬的会员，<span style='color: red;'>{{user.username}}</span>\
               <span @click='quit'>&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)'>退出</a></span>\
               </li>\
               <li v-else class='f-item'> \
                   请<a href='javascript:void(0)' @click='gotoLogin'>登录</a>　 \
                   <span><a href='register.html' target='_blank'>免费注册</a></span> \
               </li> \
           </ul> \
           <ul class='fr'>\
               <span v-show='show'>\
               <li class='f-item'>我的订单</li> \
               <li class='f-item space'></li> \
               <li class='f-item'><a href='/home-index.html' target='_blank'>我的乐优</a></li> \
               <li class='f-item space'></li> \
               <li class='f-item'><a href='/mycollection.html' target='_blank'>我的收藏</a></li> \
               <li class='f-item space'></li> \
               </span>\
               <li class='f-item'>乐优会员</li> \
               <li class='f-item space'></li> \
               <li class='f-item'>企业采购</li> \
               <li class='f-item space'></li> \
               <li class='f-item'>关注乐优</li> \
               <li class='f-item space'></li> \
               <li class='f-item' id='service'> \
                   <span>客户服务</span> \
                   <ul class='service'> \
                       <li><a href='cooperation.html' target='_blank'>合作招商</a></li> \
                       <li><a href='shoplogin.html' target='_blank'>商家后台</a></li> \
                       <li><a href='cooperation.html' target='_blank'>合作招商</a></li> \
                       <li><a href='#'>商家后台</a></li> \
                   </ul> \
               </li> \
               <li class='f-item space'></li> \
               <li class='f-item'>网站导航</li> \
           </ul> \
       </div> \
    </div>\
    ",
    name: "shortcut",
    data() {
        return {
            user: null,
            ly,
            show:false,//控制“我的订单、我的乐优、我的收藏”是否显示，用户登录了才进行显示
        }
    },
    created() {
        ly.http("/auth/verify")
            .then(resp => {
                this.user = resp.data;
                this.show = true;
            })
    },
    methods: {
        gotoLogin() {
            window.location.href = "login.html?returnUrl=" + window.location.href;
        },
        quit() {
            //this.user = null;
            ly.http.post("/auth/logOut")
                .then(window.location.reload(true)) //刷新当前页面
        },
    }
}
export default shortcut;